import React, {useState, useEffect} from 'react';

function LifecycleDeLike(props) {
    const [ lineState, setLineState ] = useState('online')
    useEffect(() => {
      console.log(`加载完成状态`, lineState)
      return () => console.log(`卸载状态`, lineState)
    })
    
    useEffect(() => {
      console.log(`更新状态`, lineState)
    }) 

    useEffect(() => {
      return () => console.log(`卸载状态`, lineState)
    }, []) 

    return <div>
      <p>当前 {props.person} 在线状态: {lineState}</p>
    </div>
}

export default LifecycleDeLike